﻿
# 指定CMake最小版本
cmake_minimum_required(VERSION 3.10.0)


# 定义工程名称
project(GxImageGadget)


# 头文件包含当前目录
set(CMAKE_INCLUDE_CURRENT_DIR ON)

include_directories(${CMAKE_CURRENT_BINARY_DIR})
include_directories(${CMAKE_SOURCE_DIR})
include_directories(${CMAKE_CURRENT_SOURCE_DIR})

# 设置自动处理Qt的moc、uic、rcc
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)

#国际化
set(TS_FILES ImageGadget_zh.ts ImageGadget_jp.ts)
qt5_create_translation(QM_FILE ${CMAKE_SOURCE_DIR} ${TS_FILES})

file(GLOB HEADER_FILES *.h)
file(GLOB SOURCE_FILES *.cpp)
file(GLOB FORM_FILES *.ui)
file(GLOB QRC_FILES *.qrc)

add_executable(
	${PROJECT_NAME} WIN32
	${HEADER_FILES}
	${SOURCE_FILES}
	${FORM_FILES}
	${QRC_FILES}
	${TS_FILES}
)

if (Qt5Widgets_FOUND)
	if(UNIX)
		target_link_libraries(
			${PROJECT_NAME}
			Qt5::Widgets
			Qt5::Core
			Qt5::Sql
			X11
		) 
	else()
		target_link_libraries(
			${PROJECT_NAME}
			Qt5::Widgets
			Qt5::Core
			Qt5::Sql
		)
	endif()
else()
	include(${QT_USE_FILE})
    target_link_libraries(
        ${PROJECT_NAME}
        ${QT_LIBRARIES}
    )
endif()

# 安装文件
install(TARGETS ${PROJECT_NAME}
    RUNTIME DESTINATION bin
)